package com.yuanqi.service;

import com.yuanqi.domain.RetailSalesOrder;
import com.yuanqi.domain.CustomerType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

/**
 * 零售销售订单服务接口
 */
public interface RetailSalesOrderService {
    
    /**
     * 创建销售订单
     */
    RetailSalesOrder createSalesOrder(RetailSalesOrder salesOrder);
    
    /**
     * 更新销售订单
     */
    RetailSalesOrder updateSalesOrder(RetailSalesOrder salesOrder);
    
    /**
     * 根据ID查找销售订单
     */
    Optional<RetailSalesOrder> findById(Long id);
    
    /**
     * 根据订单编码查找销售订单
     */
    Optional<RetailSalesOrder> findByOrderCode(String orderCode);
    
    /**
     * 查找所有销售订单
     */
    List<RetailSalesOrder> findAll();
    
    /**
     * 分页查找销售订单
     */
    Page<RetailSalesOrder> findAll(Pageable pageable);
    
    /**
     * 根据客户ID查找销售订单
     */
    List<RetailSalesOrder> findByCustomerId(Long customerId);
    
    /**
     * 根据客户姓名查找销售订单
     */
    List<RetailSalesOrder> findByCustomerName(String customerName);
    
    /**
     * 根据客户电话查找销售订单
     */
    List<RetailSalesOrder> findByCustomerPhone(String customerPhone);
    
    /**
     * 根据订单状态查找销售订单
     */
    List<RetailSalesOrder> findByOrderStatus(String orderStatus);
    
    /**
     * 根据客户类型查找销售订单
     */
    List<RetailSalesOrder> findByCustomerType(CustomerType customerType);
    
    /**
     * 根据日期范围查找销售订单
     */
    List<RetailSalesOrder> findByOrderDateBetween(LocalDateTime startDate, LocalDateTime endDate);
    
    /**
     * 更新订单状态
     */
    RetailSalesOrder updateOrderStatus(Long orderId, String status, String operatorName);
    
    /**
     * 处理订单
     */
    RetailSalesOrder processOrder(Long orderId, String operatorName);
    
    /**
     * 发货
     */
    RetailSalesOrder shipOrder(Long orderId, String operatorName, String shippingInfo);
    
    /**
     * 完成订单
     */
    RetailSalesOrder completeOrder(Long orderId, String operatorName);
    
    /**
     * 取消订单
     */
    RetailSalesOrder cancelOrder(Long orderId, String reason, String operatorName);
    
    /**
     * 删除销售订单
     */
    void deleteById(Long id);
    
    /**
     * 获取订单统计信息
     */
    Object getOrderStatistics();
    
    /**
     * 生成订单编码
     */
    String generateOrderCode();
}
